// 返回服务的label元素
function findTopRect(id) {
    const nodes = document.querySelectorAll('.x6-node')
    let res = null
    nodes.forEach(item => {
        if(item.dataset.cellId === id && item.dataset.shape === 'html' && !res) {
            res = item.childNodes[1].getElementsByClassName('topRect')[0]
        }
    })
    return res
}
// 返回库元素的label元素
function findCircle(id) {
    const nodes = document.querySelectorAll('.x6-node')
    let res = null
    nodes.forEach(item => {
        if(item.dataset.cellId === id && item.dataset.shape === 'html' && !res) {
            res = item.childNodes[1].getElementsByClassName('circle-node')[0]
        }
    })
    return res
}
// referenceRead-edge, cloneRead-edge, write-edge, 
// service-node, service2-node, circle-node, 
// artifact-node, message-node, producer-node, consumer-node
function getCellType(cell) {
    if(cell.shape === 'edge') {
        return cell.data.type
    }else if(cell.shape === 'html') {
        return cell.html+'-node'
    }else return cell.shape
}
module.exports = {findTopRect,findCircle,getCellType}
